#include "mainwindow.h"
#include "resizablerectscene.h"
#include "resizablerectitem.h"
#include <QGraphicsView>

MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
{
    // 创建场景
    scene = new ResizableRectScene(this);
    scene->setSceneRect(0, 0, 800, 600);
    scene->setBackgroundBrush(QBrush(Qt::black));

    // 创建视图
    view = new QGraphicsView(scene, this);
    view->setRenderHint(QPainter::Antialiasing);
    view->setAlignment(Qt::AlignLeft | Qt::AlignTop);

    // 设置主窗口
    setCentralWidget(view);
    setWindowTitle("可调整大小的矩形");
    resize(800, 600);
}

MainWindow::~MainWindow()
{
    // Qt的父对象机制会自动清理子对象
}
